import { http } from '@/utils/request'

/**
 * @description: 发送验证码
 * @param {string} phone 手机号
 */
export const reqSendCode = (phone) => {
  return http.post('/api/send-code', { phone })
}

/**
 * @description: 验证码登录
 * @param {string} phone 手机号
 * @param {string} code 验证码
 */
export const reqLoginByCode = ({ phone, code }) => {
  return http.post('/api/login', { phone, code })
}

/**
 * @description: 获取用户信息
 */
export const reqGetUserInfo = () => {
  return http.get('/api/userinfo')
}

/**
 * @description: 更新用户信息
 * @param {*} data
 * @returns
 */
export const reqUpdateUserInfo = (data) => {
  return http.post('/api/userupdate', data)
}
